***********************************************************************************************
***
***	INTERTEMPORAL EVIDENCE ON THE STRATEGY OF POPULISM IN THE US (Gennaro, Lecce, Morelli)
***	Replication Package
***  
*** Appendix - Table A9
***
***********************************************************************************************



clear
est clear 

* Indicate location of the replication package here
cd "/Replication Package"

**********************************************
* Upload Data                            *****
**********************************************


use "3_data/for_analysis/presidential_election_complete.dta", clear


*** standardize vars 

egen mch_s = std(mch)
egen pop_w_s = std(pop_w)
egen pc1_s = std(pc1)
egen gidron_c_s = std(gidron_c)


*** Analysis
eststo m1: reg gidron_c_s trump length i.mcode, cl(MSANAME)
eststo m2: reg gidron_c_s i.trump##c.mch_s length i.mcode, cl(MSANAME)
eststo m3: reg gidron_c_s i.trump##c.mch_s##i.swing length i.mcode, cl(MSANAME)

eststo m4: reg gidron_c_s c.mch_s##i.swing length i.mcode if trump==1, cl(MSANAME)
eststo m5: reg gidron_c_s c.mch_s##i.swing length i.mcode if trump==0, cl(MSANAME)

eststo m6: reg gidron_c_s i.trump##c.mch_s##i.swing i.mcode length i.statecode, cl(MSANAME)
eststo m7: reg gidron_c_s i.trump##c.mch_s##i.swing i.mcode length i.statecode eduatt ancestry native , cl(MSANAME)
eststo m8: reg gidron_c_s i.trump##c.mch_s##i.swing i.mcode length i.statecode eduatt ancestry native if commonstates==1, cl(MSANAME)


esttab m1 m2 m3 m4 m5 m6 m7 m8  using "4_results/tables/tabA9.tex", f label replace booktabs alignment(D{.}{.}{-1}) ///
s(N r2, fmt(0 2) label("Observations" "R-squared")) ///
nomtitles star(* 0.10 ** 0.05 *** 0.01) r2 b(3) se(3) brac nonotes
